/**
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-08 15:07:43
 * Copyright (c) 2015- joysuch-版权所有
 */
package com.joysuch.wwyt.app.controller;

import com.joysuch.wwyt.bp.bean.contractor.*;
import com.joysuch.wwyt.bp.entity.contractor.BpContractor;
import com.joysuch.wwyt.bp.service.BpContractorService;
import com.joysuch.wwyt.bp.service.BpContractorStaffService;
import com.joysuch.wwyt.core.bean.SimpleInfoBean;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * 承包商管理
 */
@RestController
@RequestMapping("/bp/app/contractor")
@Api(tags = "app承包商管理")
public class AppContractorController {

    @Autowired
    private BpContractorService bpContractorService;

    @Autowired
    private BpContractorStaffService bpContractorStaffService;


    @GetMapping("page")
    @ApiOperation(value = "承包商-分页查询", response = BpContractor.class)
    public ResultBean page(Pageable page, String contractorType,Boolean locateSync, String companyName) {
        return bpContractorService.page(page, contractorType,locateSync, companyName);
    }

    @GetMapping("/staff/page")
    @ApiOperation(value = "承包人员-分页查询", response = BpContractorDto.class)
    public ResultBean page(Pageable page,String staffName) {
        BpContractorQueryBean bean = new BpContractorQueryBean();
        bean.setName(staffName);
        bean.setPage(page.getPageNumber());
        bean.setSize(page.getPageSize());
        return bpContractorStaffService.page(bean);
    }

}
